package com.etc;

import java.sql.*;

public class PhoenixTest {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {

        //连接驱动
        Class.forName("org.apache.phoenix.jdbc.PhoenixDriver");
        //得到连接对象
        Connection connection = DriverManager.getConnection("jdbc:phoenix:master:2181");

        /**
         * 查询数据
         */

        String sql = "select * from persion";
        //根据连接对象得到发送器
        PreparedStatement statement = connection.prepareStatement(sql);
        ResultSet resultSet = statement.executeQuery();
        while (resultSet.next()) {
            System.out.println(resultSet.getString("NAME"));
        }
        statement.close();
        connection.close();
    }
}
